package com.igeek.boot.controller;

import com.igeek.boot.entity.LoginVO;
import com.igeek.boot.result.Result;
import com.igeek.boot.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author fengqq
 * @Description
 * @Date 2024/9/5  9:34
 */
@RestController
@RequestMapping("/member")
@Api(tags = "会员模块的控制层")
@Slf4j
public class MemberController {
    @Autowired
    private MemberService memberService;


    @ApiOperation("会员登录")
    @PostMapping("/login")
    public Result login(@RequestBody LoginVO loginVO){
        String token = memberService.login(loginVO);
        if (StringUtils.hasLength(token)){
            return new Result(200,"登录成功",token);
        }
        return new Result(500,"登录失败");
    }
}
